home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / c / library / mslang / poetmf / src / pictdlg.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-25  |  2.1 KB  |  86 lines

  1. // ******************************************************************
  2. //
  3. //    pictdlg.cpp : implementation file
  4. //
  5. //    Implemented classes:
  6. //        CShowPictDlg
  7. //
  8. //    Author: POET Software, August 1993
  9. //
  10. // ******************************************************************
  11.  
  12. #include <stdafx.h>        //    header to MFC
  13. #include <pictdlg.h>    //    header to this file
  14.  
  15. #ifdef _DEBUG            //    added by ClassWizard
  16. #undef THIS_FILE
  17. static char BASED_CODE THIS_FILE[] = __FILE__;
  18. #endif
  19.  
  20.  
  21.  
  22.  
  23. /////////////////////////////////////////////////////////////////////////////
  24. // CShowPictDlg dialog
  25.  
  26. CShowPictDlg::CShowPictDlg(CWnd* pParent, PtBlob *pBlob)
  27.     : CDialog(CShowPictDlg::IDD, pParent)
  28. {
  29.     m_pBlob = pBlob;    //    set Blob
  30.  
  31.     //{{AFX_DATA_INIT(CShowPictDlg)
  32.         // NOTE: the ClassWizard will add member initialization here
  33.     //}}AFX_DATA_INIT
  34. }
  35.  
  36.  
  37.  
  38. void CShowPictDlg::DoDataExchange(CDataExchange* pDX)
  39. {
  40.     CDialog::DoDataExchange(pDX);
  41.     //{{AFX_DATA_MAP(CShowPictDlg)
  42.         // NOTE: the ClassWizard will add DDX and DDV calls here
  43.     //}}AFX_DATA_MAP
  44. }
  45.  
  46. void CShowPictDlg::Init ()
  47. {
  48.     m_Bitmap.Setup (this, m_pBlob);    //    load bitmap from Blob
  49.  
  50.     int frameWidth, frameHeight, captionHeight;
  51. // adjust DialogWindow
  52.     frameWidth = GetSystemMetrics(SM_CXDLGFRAME) * 2;
  53.     frameHeight = GetSystemMetrics(SM_CYDLGFRAME);
  54.     captionHeight = GetSystemMetrics(SM_CYCAPTION);
  55.     MoveWindow(40, 40,        //    set correct metrics to dialogwindow
  56.         m_Bitmap.GetBMWidth () + frameWidth,
  57.         m_Bitmap.GetBMHeight () + captionHeight + frameHeight);
  58. }
  59.  
  60. BEGIN_MESSAGE_MAP(CShowPictDlg, CDialog)
  61.     //{{AFX_MSG_MAP(CShowPictDlg)
  62.     ON_WM_PAINT()
  63.     //}}AFX_MSG_MAP
  64. END_MESSAGE_MAP()
  65.  
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CShowPictDlg message handlers
  68.  
  69. void CShowPictDlg::OnPaint()
  70. {
  71.     CPaintDC dc(this); // device context for painting
  72.  
  73.     m_Bitmap.Draw (&dc, 0, 0);    //    paint bitmap
  74.     
  75.     // Do not call CDialog::OnPaint() for painting messages
  76. }
  77.  
  78. BOOL CShowPictDlg::OnInitDialog()
  79. {
  80.     CDialog::OnInitDialog();
  81.     
  82.     Init ();    //    load bitmap from Blob
  83.     
  84.     return TRUE;  // return TRUE  unless you set the focus to a control
  85. }
  86.